<%@page contentType="text/html;charset=UTF-8"%>
<%@ page import="whf.framework.web.Constants"%>
<%@ page import="whf.framework.util.ParamUtils" %>

<%@taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/tlds/framework.tld" prefix="framework"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><framework:attr source="STRUTS-META" attr="name" /></title>
<jsp:include page="/common/inc/select.jsp" />
</head>
<%
long parentId = ParamUtils.getLongParameter(request, "parentId", 0);
String queryString = "";
if(parentId > 0){
	queryString = "t.parent.id="+parentId+" order by t.name";
} else {
	queryString = (String)request.getAttribute("ext0"); //从保留域中获取
	if(queryString == null){
		queryString = "t.parent is null"+" order by t.name";
	}
}
pageContext.setAttribute("ext0", queryString);
%>
<script language="javascript">
function currentForm(){
	formName = '<framework:attr source="STRUTS-FORMNAME" />';
	return document.forms[formName];
}
function submitForm(nextMethod){
	if(nextMethod == "delete" || nextMethod == "remove"){
		if(confirm("<bean:message key="form.confirm_delete" />")){
			<framework:attr source="STRUTS-FORMNAME" />("webMethod").value=nextMethod;
			window.event.srcElement.disabled=true;
			<framework:attr source="STRUTS-FORMNAME" />.submit();
		}
	}else{
		<framework:attr source="STRUTS-FORMNAME" />("webMethod").value=nextMethod;
		window.event.srcElement.disabled=true;
		<framework:attr source="STRUTS-FORMNAME" />.submit();
	}
}
</script>
<body>
<html:form action='<%=  (String)request.getAttribute(Constants.STRUTS_PATH) %>' method="post">
<html:hidden property="webMethod" value="" />
<framework:ext />
<framework:table pkStyle="checkbox_counter" navPosition="both" queryString="<%= queryString %>">
<framework:caption><span class="whf_object_title"><framework:attr source="STRUTS-META" attr="name" /></span></framework:caption>
</framework:table>

<framework:funcbtn operation="prepareCreate" validationFunction="" valueKey="form.create" />
<framework:funcbtn operation="prepareUpdate" validationFunction="selectionMoreThanOne" valueKey="form.update" />
<framework:funcbtn operation="duplicate" 	validationFunction="selectionMoreThanOne" valueKey="form.duplicate" />
<framework:funcbtn operation="delete" 		validationFunction="selectionMoreThanOne" valueKey="form.delete" />
<html:reset><bean:message key="form.reset" /></html:reset>
</html:form>

</body>
</html> 